﻿@inherits OwningComponentBase
@using ZLJ.Admin.ClientProxy
@using ZLJ.Application.Common.Share.Session
@using ZLJ.RCL

@* <RenderModeItem @ref="server" @rendermode="InteractiveServer" /> *@
@*
@inject AppContainer appContainer
@inject AbpUserConfigurationService abpUserCfgService *@

@code {
    // RenderModeItem server;

    // bool cs => (DateTime.Now - server.LastTime).TotalSeconds > 30;
    protected override void OnInitialized()
    {
        if (OperatingSystem.IsBrowser())
            Console.WriteLine("客户端模式");
        else
            Console.WriteLine("服务端模式");
        // base.OnInitialized();
    }
    protected override async Task OnInitializedAsync()
    {
        if (OperatingSystem.IsBrowser())
        {
            var abpUserCfgService = ScopedServices.GetRequiredService<AbpUserConfigurationService>();
            var sessionAppService = ScopedServices.GetRequiredService<SessionAppService>();
            var appContainer = ScopedServices.GetRequiredService<AppContainer>();
            var t1 = abpUserCfgService.GetAll().ContinueWith(r =>
            {
                appContainer.AbpUserConfiguration = r.Result;
            });
            appContainer.CurrentLoginInformations= sessionAppService.GetCurrentLoginInformations();
        }
        // appContainer.AbpUserConfiguration = await abpUserCfgService.GetAll();
        //  Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(appContainer));
    }

}
